import logging

import redis


class Config(object):
    DEBUG = True
    # session配置
    SECRET_KEY = 'rO1wzhWWQUx1RHNL1Oc48tOAoRuZ5m5Pcq7IzfP5GRhgxRfSTbxkHrM/72NtCS5c'
    # 数据库的配置信息
    SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:mysql@localhost:3306/information'
    # 关闭追踪数据库的修改
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    # redis相关
    REDIS_HOST = "127.0.0.1"
    REDIS_RORT = '6379'

    # session配置
    SESSION_TYPE = "redis"

    SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST, port=REDIS_RORT)

    SESSION_USE_SIGNER = True
    SESSION_PERMANENT = False
    # 时间（秒）
    PERMANENT_SESSION_LIFETIME = 12000

    LOG_LEVEL = logging.DEBUG


class DevelopementConfig(Config):
    """开发环境"""
    DEBUG = True
    LOG_LEVEL = logging.DEBUG


class ProductionConfig(Config):
    """配置环境"""
    DEBUG = True
    LOG_LEVEL = logging.WARNING


config = {
    "develop": DevelopementConfig,
    "productionConfig": DevelopementConfig,
}
